package cn.xwt.weidisk.pojo.dto;

import cn.xwt.weidisk.constant.ErrorCode;

/**
 * @author 薛慰涛
 * 响应消息
 */
public class Resp {
    private String code;
    private String msg;
    private Object object;

    public Resp() {
    }

    public Resp(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Resp(String code, String msg, Object object) {
        this.code = code;
        this.msg = msg;
        this.object = object;
    }

    public static Resp success() {
        return new Resp(ErrorCode.SUCCESS.getCode(), "操作成功");
    }

    public static Resp serverError() {
        return new Resp(ErrorCode.USER_OPERATION_EXCEPTION.getCode(), "服务器繁忙");
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    @Override
    public String toString() {
        return "Resp{" +
                "code='" + code + '\'' +
                ", msg='" + msg + '\'' +
                ", object=" + object +
                '}';
    }
}
